In an inspection process in the production of containers having a mouth, the outside diameter, inside diameter, and slope and the like of the top surface of the mouth are examined. A conventional method adopted in this mouth inspection process uses a closure member having a predetermined diameter, which is inserted into the mouth to inspect the mouth inside diameter. With this inspection method, if the closure member can be inserted into the mouth, the container is determined to be “good,” whereas, if the closure member cannot be inserted into the mouth, the container is determined to be “defective.”
However, such an inspection method in which a closure member is contacted with the inner surface of the mouth is not welcome particularly for containers for holding food or beverage, and the trend is toward non-contact inspection methods, for example, using optical devices.
FIG. 10 illustrates a common inspection device using an optical device. In the drawing, 101 denotes a light source for generating diffused light. Part of the light from the light source 101 is projected to the bottom 99b of the container 99 through a circular aperture 103 in a diaphragm plate 102. The optical axis 104 extends through the center of the mouth 99a of the container 99, and the optical device 100 is arranged on the optical axis 104 above the container 99. The optical device 100 includes an optical system 105 having a plurality of integrally mounted lenses with a diaphragm disposed between the lenses to form an optical image 107 of the mouth 99a on an image surface 106. The solid lines in the drawing reaching the image surface 106 indicate the paths of light forming a bright part of the optical image 107. The dotted lines are paths of imaginary light corresponding to a dark part in the image and there are no actual light rays along these lines.
The optical image 107 includes, as shown in FIG. 11, a circular bright part 108 in the center formed by light that has passed through the opening of the mouth, and an annular dark part 109 formed around the bright part indicating the top surface 99d of the mouth. Between the circular bright part 108 and the annular dark part 109 are formed a plurality of annular bright parts 110 formed by light reflected by the inner surface of the mouth 99a (denoted at Lp in FIG. 10). Accordingly, this optical image 107 does not provide any accurate information regarding the shape of the top surface 99d or the opening 99c of the mouth, nor does it give any information on the inner contour of the part P where the inner surface protrudes most, i.e., inspection of the mouth interior is hardly possible with an inspection device of the design shown in FIG. 10.
Compared to this, an optical inspection device disclosed before in Japanese Published Unexamined Patent Application No. Hei 8-54213 can form an optical image that provides information on the inner contour of a container mouth; its optical device uses a telecentric optical system 111 shown in FIG. 12.
In FIG. 12, 2 denotes a light source for generating diffused light, which emits light to the bottom 99b of the container 99. The amount of light from the light source 2 is controlled by a circular aperture 4 in a diaphragm plate 3. An optical device 6 including the telecentric optical system 111 is arranged on the optical axis 5 extending through the center of the mouth 99a of the container 99, and an optical image of the mouth 99a of the container 99 is formed on an image surface 7 consisting of a CCD. The optical image is input to an image processing device 8 in which the image of the mouth 99a is processed for the measurement of the inside diameter. A display 9 in the drawing is for displaying the optical image and input or output data, and the like.
The telecentric optical system 111 is made up of an assembly of lenses 10 that can be focused (hereinafter referred to simply as “lens”) and a diaphragm 11 arranged on the optical axis 5 such that an aperture 11a in the diaphragm 11 is positioned at the focus F of the lens 10. With this optical system 111, as shown in FIG. 13, only the light rays that are parallel to the optical axis 5 are passed through the aperture 11a in the diaphragm 11 and collected on the image surface 7, after passing through and being refracted by the lens 10. The light rays that are not parallel to the optical axis 5, for example, the light rays reflected by the inner surface of the mouth 99a or the like, also pass through and are refracted by the lens 10. However, the thus refracted light rays are shut off so that they do not enter the aperture 11a in the diaphragm 11.
In FIG. 13, the paths of light forming a bright part of the optical image 12 are indicated by the solid lines, while the paths of imaginary light corresponding to a dark part are indicated by dotted lines (there are no actual light rays along these lines).
The lens 10 is set such that the most protruding part P in the inner surface of the mouth 99a is in focus, and thus the optical system 111 can form an optical image 12 that provides information on the inner contour of the mouth 99a of the container 99, in particular, of the most protruding part P in the inner surface of the mouth 99a. 
This optical image 12 includes, as shown in FIG. 14, a circular bright part 13 in the center formed by light that has passed through the opening of the mouth, and a first annular dark part 14 therearound that appears because part of light is shut off by the most protruding part P of the mouth 99a, and a second annular dark part 15 formed therearound indicating the top surface 99d of the mouth.
This optical image 12 is input to the image processing device 8, in which its gray scale image is converted into a binary image to calculate out a largest inscribed circle 16 of the first dark part 14. The diameter of this largest inscribed circle 16 corresponds to the inside diameter (effective diameter) of the mouth 99a. Thus, if the measured inside diameter r is out of a predetermined range, i.e., if r>R1 or r<R2, where R1 and R2 are the upper limit and the lower limit of the inside diameter of the mouth 99a, respectively, the container is determined as defective.
The principal rays parallel to the optical axis 5 for forming the optical image 12 actually include, as shown in FIG. 15, components of light directed at a maximum angle of α (indicated by dash-dot lines in the drawing) in the outer directions around the principal rays L (indicated by solid lines). This results from the diameter of the aperture 11a in the diaphragm 11 being set large enough to achieve an amount of light necessary for the measurement. A, B, and C in the drawing denote the points on the container 99 in focus, i.e., they represent the points in the vicinity of the most protruding part P in the inner surface of the mouth 99a. 
Of the light rays reflected by the vicinities of the most protruding part P in the inner surface of the mouth 99a, particularly those (indicated by Lp in FIG. 13) that overlap the components of light L′ directed inwardly relative to the principal rays L cause formation of a shadow 18 (see FIG. 14) along the inner edge of the first dark part 14 in the optical image 12.
This shadow 18 has an intermediate brightness, and when this appears in the optical image 12, it makes the inner edge of the first dark part 14 indistinct, which can cause erroneous measurement results of the diameter of the largest inscribed circle 16. Another problem is that the binary threshold level is hard to select when binarizing the gray scale image of the optical image 12 in the image processing device.
A possible solution to the problem is, using the diaphragm plate 3, to restrict the paths of the light rays Lp reflected by the vicinities of the most protruding part P in the inner surface of the mouth 99a of the container 99 to reduce the amount of light that overlaps the light components L′. This method, however, is not preferable because the influence of light refraction at the bottom 99b of the container 99 will be too large.
The reason for using the diffusion light source 2 is to compensate for the principal rays parallel to the optical axis 5 that are lost by light refraction at the bottom 99b of the container 99 because of the shape, uneven thickness, or an incised mold number or the like of the bottom, by refraction of other angles of light. If the aperture 4 of the diaphragm plate 3 is made smaller to restrict the paths of the reflected light Lp, the principal rays that are lost by the light refraction at the bottom 99b caused by its shape or the like cannot be compensated for by refraction of other angles of light, as a result of which an image of the container bottom 99b will appear in the optical image 12.
To avoid this problem, the diameter of the aperture 4 in the diaphragm plate 3 needs to be set substantially large relative to the inside diameter of the mouth 99a of the container 99 in order to enable the compensation of the principal rays parallel to the optical axis 5 that are lost by the light refraction at the bottom 99b of the container 99 caused by its shape or the like by refraction of other angles of light. If the difference between the inside diameter of the mouth and that of the bottom of the container is small, the container cannot be placed on the diaphragm plate 3 when inspected, because the diameter of the aperture 4 in the diaphragm plate 3 will have to be larger than the bottom diameter in order to compensate for the lost principal rays by refraction of other angles of light. Since the diaphragm plate 3 is used also for supporting the container, the container must be suspended during inspection if it cannot be placed on the diaphragm plate 3. On the other hand, if the diameter of the aperture 4 in the diaphragm plate 3 is made small so that the container can be placed on the diaphragm plate 3 during inspection, then the lost principal rays parallel to the optical axis 5 cannot be compensated for sufficiently by refraction of other angles of light, as described above.
The present invention was devised based on the foregoing problems, its object being to provide a container mouth inspection device which can produce an ideal optical image that reliably provides information on the inner contour of the container mouth, and which enables accurate and speedy measurement of the inside diameter or the like of the container mouth.